<div class="fa-box">
    {volist name="guestbook_list" id="guestbook"}
    <fieldset class="layui-elem-field">
        <legend>{$guestbook.link}的站长 - {$guestbook.create_time}</legend>
        <div class="layui-field-box">
            {$guestbook.content}
        </div>
    </fieldset>
    {/volist}
    {$guestbook_list->render()}
</div>
<div class="fa-box">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>提交留言</legend>
        <div class="layui-field-box">
            <form class="layui-form fa-ajax-form" method="post" enctype="multipart/form-data" action="{:url('index/guestbook/insert')}">
                <div class="layui-form-item">
                    <label class="layui-form-label">个人主页</label>
                    <div class="layui-input-block">
                        {:token()}
                        <input type="text" name="link" required lay-verify="required" placeholder="您的个人主页地址 请填写包含http://或https://的完整地址"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">QQ</label>
                    <div class="layui-input-block">
                        <input type="text" name="qq" required lay-verify="required" placeholder="您的QQ"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">email</label>
                    <div class="layui-input-block">
                        <input type="text" name="email" required lay-verify="required" placeholder="您的个人网络邮箱"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">留言内容</label>
                    <div class="layui-input-block">
                        <textarea name="content" placeholder="您的评论" class="layui-textarea"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <img id="captcha" src="{:captcha_src()}"></div>
                </div>
                <label class="layui-form-label">验证码</label>
                <div class="layui-input-block">
                    <input type="text" name="captcha" required lay-verify="required" placeholder="请输入验证码"
                           autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid layui-word-aux">
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                    </div>
                </div>
            </form>
        </div>
    </fieldset>
</div>
<script>
    layui.use(['layer'], function () {
        var layer = layui.layer;
        var $ = layui.$;

        /!*验证码刷新*!/
        var verify = document.getElementById('captcha');
        var url = verify.src;
        verify.addEventListener('click', function (e) {
            verify.src = url + '?' + (new Date).getSeconds();
        });

    })
</script>